#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 1e3+7;
LL num[MAXN];
LL dp_max[MAXN], dp_min[MAXN];
char op[10];
LL solve(LL a, LL b, char opp) {
    if (opp == '+') return a+b;
    if (opp == '-') return a-b;
    if (opp == '*') return a*b;
    if (opp == '/') return a/b;
    return -1;
}

int main() {
#ifdef hai
    freopen("in.txt", "r", stdin);
#endif
    int T;
    scanf("%d", &T);
    while (T--) {
        int n,m;
        LL k;
        scanf("%d %d %lld", &n, &m, &k);
        for (int i=1; i<=n; ++i) scanf("%lld", &num[i]);
        scanf("%s", op);
        for (int i=0; i<=n; ++i) dp_max[i] = dp_min[i] = k;
        for (int i=0; i<m; ++i) {
            char& c = op[i];
            LL _max=dp_max[i];
            LL _min=dp_min[i];
            for (int j=i+1; j<=n-m+i+1; ++j) {
                LL tma=dp_max[j];
                LL tmi=dp_min[j];
                LL t1 = solve(_max, num[j], c);
                LL t2 = solve(_min, num[j], c);
                dp_max[j] = max(t1, t2);
                dp_min[j] = min(t1, t2);
                _max = max(tma, _max);
                _min = min(tmi, _min);
            }
//            for (int j=1; j<=n; ++j) {
//                printf("max: %lld min: %lld\n", dp_max[j], dp_min[j]);
//            }
//            printf("\n");
        }
        LL res = dp_max[m];
        for (int i=m; i<=n; ++i) {
            if (dp_max[i] > res) res = dp_max[i];
        }
        printf("%lld\n", res);
    }
    return 0;
}
